// pages/management/pack/pack.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    active: 0,
    tabList: [
      {
        title: "包装管理",
        component: "pack"
      },
      {
        title: "物料管理",
        component: "material"
      }
    ]
  },

  // 获取页面数据
  getData() {},

  onChange(e) {
    this.setData({
      active: e.detail.index
    });
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    const pack = this.selectComponent(".pack_com");
    const material = this.selectComponent(".material_com");
    if (pack && pack.onPullDownRefresh) {
      pack.onPullDownRefresh();
    } else if (material && material.onPullDownRefresh) {
      material.onPullDownRefresh();
    } else {
      wx.stopPullDownRefresh();
    }
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    const pack = this.selectComponent(".pack_com");
    const material = this.selectComponent(".material_com");
    if (pack) {
      pack.onReachBottom && pack.onReachBottom();
    } else if (material) {
      material.onReachBottom && material.onReachBottom();
    }
  }
});
